
#ifndef __DOM_DOCUMENT_H
#define __DOM_DOCUMENT_H

#include <libxml/xmlwriter.h>

/** A wrapper around the libxml2 document pointer which facilitates data 
 * gathering from the DOM object. */
class DOMDocument
{
   public:
      DOMDocument(const char *buffer, int length);
      DOMDocument(const char *filename);
      DOMDocument();
      ~DOMDocument();
      xmlNodePtr getRootNode();
      void generateRootNode(const char *name);
      void setProperty(xmlNodePtr node, const char *key, const char *value);
      xmlNodePtr createChildNode(xmlNodePtr node, const char *name);
      xmlNodePtr findNode(xmlNodePtr node, const char *name);
      xmlNodePtr findNode(xmlNodePtr node, const char *name, const char *attribname, const char *attribvalue);
      int hasAttrib(xmlNodePtr node, const char *attribname);
      char *getAttribValueString(xmlNodePtr node, const char *attribname);
      int readIn(const char *buffer, int length);
      int readIn(const char *filename);
      int writeOut(const char *filename);
      int writeOut(xmlBufferPtr buffer);
   private:
      /** The pointer to the document that the class provides access to. */
      xmlDocPtr tdoc;
};

#endif
